package objs;

import service.Play;

import java.awt.*;


public class BombFaseobj extends Pojo{
    public BombFaseobj() {
    }

    public BombFaseobj(Image image, int x, int y, int width, int height, double speed, Play frame) {
        super(image, x, y, width, height, speed, frame);
    }

    public BombFaseobj(Image image, int x, int y, double speed) {
        super(image, x, y, speed);
    }

    @Override
    public void paintSelf(Graphics gImage) {
        gImage.drawImage(image,x,y,width,height,null);
        y-=speed;
        if(y<0){
            Play.removeList.add(this);
        }
        for (int i=0;i<Play.bossobjList.size();i++){
            if(this.getRec().intersects(Play.bossobjList.get(i).getRec())){
                Play.bossobjList.get(i).setLife(Play.bossobjList.get(i).getLife()-50);
                Play.removeList.add(this);
                BombExpolodeobj bombExpolodeobj=new BombExpolodeobj(Play.explode2,this.x, this.y-50, 63, 57,0, this.frame);
                bombExpolodeobj.setBombDisappearState(1);
                Play.pojoList.add(bombExpolodeobj);
            }
        }
    }
}
